/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mantechhelpdesk.entity;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import mantechhelpdesk.dao.DbConnection;
import mantechhelpdesk.dao.DepartmentsDao;
import mantechhelpdesk.dao.NotFoundException;

/**
 *
 * @author DinhThang
 */
public class Threads implements Cloneable, Serializable {

    /**
     * Persistent Instance variables. This data is directly mapped to the
     * columns of database table.
     */
    private int threadID;
    private Integer departmentID;
    private String departmentName;
    private String threadName;
    private Date createTime;
    private boolean isEnable = false;

    /**
     * Constructors. DaoGen generates two constructors by default. The first one
     * takes no arguments and provides the most simple way to create object
     * instance. The another one takes one argument, which is the primary key of
     * the corresponding table.
     */
    public Threads() {
    }

    public Threads(int ThreadIDIn) {

        this.threadID = ThreadIDIn;

    }

    /**
     * Get- and Set-methods for persistent variables. The default behaviour does
     * not make any checks against malformed data, so these might require some
     * manual additions.
     */
    public int getThreadID() {
        return this.threadID;
    }

    public void setThreadID(int ThreadIDIn) {
        this.threadID = ThreadIDIn;
    }

    public Integer getDepartmentID() {
        return this.departmentID;
    }

    public String getDepartmentName() {
        return departmentName;
    }

    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }

    public void setDepartmentID(Integer DepartmentIDIn) {
        try {
            DepartmentsDao departmentsDao = new DepartmentsDao();
            Departments depart = departmentsDao.getObject(DbConnection.getConnection(), DepartmentIDIn);
            if (null != depart && depart.getDepartmentName().length() > 0) {
                departmentName = depart.getDepartmentName();
            }
            this.departmentID = DepartmentIDIn;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public String getThreadName() {
        return this.threadName;
    }

    public void setThreadName(String ThreadNameIn) {
        this.threadName = ThreadNameIn;
    }

    public Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Date CreateTimeIn) {
        this.createTime = CreateTimeIn;
    }

    public boolean getIsEnable() {
        return this.isEnable;
    }

    public void setIsEnable(boolean IsEnableIn) {
        this.isEnable = IsEnableIn;
    }

    /**
     * setAll allows to set all persistent variables in one method call. This is
     * useful, when all data is available and it is needed to set the initial
     * state of this object. Note that this method will directly modify instance
     * variales, without going trough the individual set-methods.
     */
    public void setAll(int ThreadIDIn,
            Integer DepartmentIDIn,
            String ThreadNameIn,
            Date CreateTimeIn,
            boolean IsEnableIn) {
        this.threadID = ThreadIDIn;
        this.departmentID = DepartmentIDIn;
        this.threadName = ThreadNameIn;
        this.createTime = CreateTimeIn;
        this.isEnable = IsEnableIn;
    }

    public Threads(int ThreadIDIn,
            Integer DepartmentIDIn,
            String ThreadNameIn,
            Date CreateTimeIn,
            boolean IsEnableIn) {
        this.threadID = ThreadIDIn;
        this.departmentID = DepartmentIDIn;
        this.threadName = ThreadNameIn;
        this.createTime = CreateTimeIn;
        this.isEnable = IsEnableIn;
    }
}
